@extends('layout')
@section('content')
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i>
        当前位置: <span class="c-gray en">&gt;</span>
        游戏管理 <span class="c-gray en">&gt;</span>
        游戏配置列表
    </nav>
    <div class="page-container">
        <div class="text-c">
            <form action="" method="get">
                关键字：
                <input type="text" name="keywords" id="keywords"
                       value="{{ $query['keywords'] }}"
                       placeholder="游戏名|用户名|手机" style="width:100px" class="input-text">
                订单号：
                <input type="text" name="orderno" id="orderno" placeholder=""
                       value="{{ $query['orderno'] }}"
                       style="width:100px" class="input-text">

                <button name="" id="" class="btn btn-success" type="submit">查询</button>
                {{--<button name="" id="" class="btn btn-info" type="reset">重置</button>--}}
                <a class="btn btn-info" style="line-height:1.6em;margin-top:3px" id="btn-refresh" href="javascript:;" onclick="location.replace('{{ url('nonPublicVersion/gameConfig') }}')" title="重置" >重置</a>
            </form>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg table-hover table-sort">
                <thead>
                <!--序号	手机号	用户名	游戏名称	订单金额	游戏订单号	商品名称	区服	角色ID	角色名称	渠道号	创建时间	支付结果	通知结果-->
                <tr class="text-c">
                    <th width="30">序号</th>
                    <th width="50">手机号</th>
                    <th width="100">用户名</th>
                    <th width="100">游戏名称</th>
                    <th width="120">订单金额</th>
                    <th width="150">订单号</th>
                    <th width="120">商品名称</th>
                    <th width="75">区服</th>
                    <th width="75">角色ID</th>
                    <th width="75">角色名称</th>
                    <th width="75">渠道号</th>
                    <th width="75">创建时间</th>
                    <th width="75">支付结果</th>
                    <th width="75">通知结果</th>
                    <th width="50">操作</th>
                </tr>
                </thead>
                <tbody>
                    @if($lists)
                        @foreach($lists as $key => $list)
                            <tr class="text-c">
                                <td>{{ $key +1 }}</td>
                                <td>{{ $list->phone  }}</td>
                                <td>{{ $list->username }}</td>
                                <td>{{ $list->app_name }}</td>
                                <td>{{ $list->money }}</td>
                                <td>{{ $list->orderno }}</td>
                                <td>{{ $list->tool_name }}</td>
                                <td>{{ $list->server }}</td>
                                <td>{{ $list->roleid }}</td>
                                <td>{{ $list->rolename }}</td>
                                <td>{{ $list->sdk_channel_code }}</td>
                                <td>{{ $list->create_time }}</td>
                                <td>{{ $list->status }}</td>
                                <td>{{ $list->notify_status }}</td>
                                <td class="f-14 td-manage">
                                    <a style="text-decoration:none" class="ml-5" onClick="openDialog('','{{ url('nonPublicVersion/gameConfig/' . $list->app_id. '/edit') }}','','',true)" href="javascript:;" title="编辑">
                                        补发通知</a>
                                </td>
                            </tr>
                        @endforeach
                    @endif
                </tbody>
            </table>
            {{ $lists->links() }}

        </div>
    </div>
@endsection
@section('script')
<script type="application/javascript">
    laypage({
        cont: $('#page'), //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：&lt;div id="page1">&lt;/div>
        pages: '{{ isset($lists['totalPage']) ? $lists['totalPage'] : 1 }}', //通过后台拿到的总页数
        curr: '{{ $lists['current_page'] }}', //初始化当前页
{{--        last:'{{ $lists['lastPage'] }}',--}}
        jump:function (e,first) {
            var paginate = $('#paginate').val();
            var total = '{{ $lists['total'] }}';
            var totalPage= '{{ isset($lists['totalPage']) ? $lists['totalPage'] : 1 }}';
            if(e.curr > Math.ceil( total / paginate)){
                e.curr = Math.ceil( total / paginate);
            }
            if (!first){
                console.info('{{ $lists['url'] . '?page=' }}' + e.curr + '&paginate=' + paginate +'&' +  '{{ $params }}')
                var url = '{{ $lists['url'] . '?page=' }}' + e.curr + '&paginate=' + paginate +'&' +  '{{ $params   }}';
                window.location.href = encodeURI(url);
            }
        }
    });

    $(".go").click(function () {
        var paginate = $('#paginate').val();
        window.location.href = '{{ $lists['url'] }}' + '?paginate=' + paginate;
    });

    function deleteChannel (id) {
        var index = layer.confirm('您是否确定要删除选中的条目？', {
            btn: ['确认','取消'] //按钮
        }, function(){
            request('/nonPublicVersion/gameConfig/'+id,function (data) {
                layer.close(index);
                $("#btn-refresh").click();
            },{},'DELETE');
        });
    }

    function del() {
        var objs = $("input[name='ids[]']");
        var arr = [];
        $.each(objs,function (k,v) {
            if ($(this).is(':checked')){
                var val = $(this).val();
                arr.push(val);
            }
        });
        if(arr == ''){
            layer.alert('请选择要删除的条目');
            return;
        }
        var index = layer.confirm('您是否确定要删除选中的条目？', {
            btn: ['确认','取消'] //按钮
        }, function(){
            request('/nonPublicVersion/gameConfig/'+arr[0],function (data) {
                layer.close(index);
                $("#btn-refresh").click();
            },{ids:arr.toString()},'DELETE');
        });
    }
</script>
@endsection